<%--
    Document   : newjsp
    Created on : Oct 28, 2009, 3:50:43 AM
    Author     : Phong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="java.util.*,DAOClass.InfoMember"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


        <link rel="stylesheet" href="../css/style.css" />
        <link rel="stylesheet" href="../css/front.css"  />
        <link rel="stylesheet" href="../css/backend.css" />
         <%@include file="include/validate.jsp" %>
        <title>Edit Member/title>
            
    </head>
    <body bgcolor="#154978">
        <jsp:useBean id="update" class="DAOClass.Members" >

        </jsp:useBean>

        <table width="1024" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" align="center">
            <!--DWLayoutTable-->
            <tr>
                <td width="1024" height="157" valign="top" background="../images/Banner.jpg">

                </td>
            </tr>
            <tr>
                <td height="463" valign="top">
                    <table width="100%" border="0" cellpadding="2" cellspacing="2">
                        <!--DWLayoutTable-->
                        <tr>
                            <td height="28" colspan="2" valign="top" background="../images/top_button.gif" align="right">
                                              <span class="titleMenu">
              <a href="../index.jsp">Home Page</a> &nbsp;&nbsp; ||&nbsp;&nbsp;
              <a href="../include/logoff.jsp">Logoff</a>
              &nbsp;&nbsp;&nbsp;
              </span>
                            </td>
                        </tr>
                        <tr>
                            <td width="150" height="537" valign="top" style="background-color:#666666">

                                <!-- MENU -->
                                <%@include file="menu.jsp" %>
                                <!--END MENU-->	</td>

                            <td width="858" align="center" valign="top" style="margin-top:30px">
                                <form name="updateMember" action="../update" method="POST">

                                    <%
                                        ArrayList<InfoMember> arrMem = new ArrayList<InfoMember>();

                                        String userName = "";


                                        userName = request.getParameter("u");
                                        if (userName != "") {
                                            arrMem = update.getMembersByName(userName);
                                            if (arrMem.size() > 0) {
                                                for (int i = 0; i < arrMem.size(); i++) {

                                                    String strUser = arrMem.get(i).getUserName();
                                                    String strPassword = arrMem.get(i).getPassword();
                                                    int intIDG = arrMem.get(i).getGroup();
                                                    String strName = arrMem.get(i).getFullName();
                                                    int intSex = arrMem.get(i).getSex();
                                                    String strTel = arrMem.get(i).getPhone();
                                                    String strBirthDay = arrMem.get(i).getBirthDay();
                                                    String strAdd = arrMem.get(i).getAddress();
                                                    String strMail = arrMem.get(i).getEmail();
                                                    int intStatus = arrMem.get(i).getStatus();


                                    %>
                                    <table width="86%" style="border:1px solid dotted">
                                        <tr>
                                            <td colspan="2" align="center"><h3>Update Member</h3></td>

                                        </tr>
                                        <tr>
                                            <td width="341" align="left">UserName : </td>
                                            <td width="501" align="left"><input name="userName" type="text" value="<%=strUser%>" size="30" readonly></td>
                                        </tr>
                                        <tr>
                                            <td width="341" align="left">Password : </td>
                                            <td width="501" align="left"><input name="pass" type="password" value="<%=strPassword%>" size="30" ></td>
                                        </tr>
                                        <tr>
                                            <td align="left">FullName : </td>
                                            <td align="left"><input type="text" name="name" size="30" value="<%=strName%>" ></td>
                                        </tr>
                                        <tr>
                                            <td align="left">Sex : </td>
                                            <td align="left">
											<%
											 if (intSex == 1) {
											%>
                                                 <input type="radio" name="sex" value="1" checked> Nam
                                                 <input type="radio" name="sex" value="0" > Nữ
                                            <%
											 } else {
											%>
                                            	<input type="radio" name="sex" value="1" > Nam
                                                 <input type="radio" name="sex" value="0" checked> Nữ
                                            <%
											 }
											%>
                                            
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">Address : </td>
                                            <td align="left"><textarea name="add" rows="5" cols="23" >
                                            <%=strAdd%>
                                            </textarea></td>
                                        </tr>
                                        <tr>
                                            <td align="left">Telephone : </td>
                                            <td align="left">
                                            <input type="text" size="30" name="tel" value="<%=strTel%>">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">Email : </td>
                                            <td align="left"><input type="text" size="30" name="mail" value="<%=strMail%>"></td>
                                        </tr>
                                        <tr>
                                            <td align="left">Birthday : </td>
                                            <td align="left"><input type="text" size="30" name="birthday" value="<%=strBirthDay%>">
											</td>
                                        </tr>
                                        <tr>
                                            <td align="left">Status :</td>
                                            <td align="left">
                                            <%
											 if (intStatus == 1) {
											%>
                                                 <input type="radio" name="status" value="1" checked> Enable
                                                 <input type="radio" name="status" value="0" > Disable
                                            <%
											 } else {
											%>
                                            	<input type="radio" name="status" value="1" > Enable
                                                 <input type="radio" name="status" value="0" checked> Disable
                                            <%
											 }
											%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">Group : </td>
                                            <td align="left">
                                             <%
											 if (intIDG == 1) {
											%>
                                                 <input type="radio" name="idg" value="1" checked> Admin
                                                 <input type="radio" name="idg" value="2" > Member
                                            <%
											 } else {
											%>
                                            	<input type="radio" name="idg" value="1" > Admin
                                                 <input type="radio" name="idg" value="2" checked> Member
                                            <%
											 }
											%>
                                            </td>
                                        </tr>
										<tr>
                                    <td colspan="2" align="left">&nbsp;</td>
                                        </tr>
                                        <tr>
                                            <td align="right"><label>
                                              <input type="submit" name="button" id="button" value="Save">
                                            </label></td>
                                            <td align="left"><label>
                                            <input type="reset" name="button2" id="button2" value="Reset">
                                          </label></td>

                                        </tr>
                                    </table>

                                    <%                }
                                            }
                                        }
                                    %>
                                </form>

                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>

    </body>
</html>
